package com.hmall.common.client;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

    @FeignClient(value = "itemservice")
    public interface feignClient {
        @GetMapping("/item/list")
        PageDTO<Item> list(@RequestParam(defaultValue = "1") Integer page,
                           @RequestParam(defaultValue = "5") Integer pageSize);
        @GetMapping("/item/{id}")
        Item selectById(@PathVariable("id") Long id);

        @PutMapping("/item/stock/{itemId}/{num}")
        void reduce(@PathVariable(value = "itemId")long id,
                           @PathVariable(value = "num")Integer num);
    }

